# dfs搜索

print(f"共能组成{24}种无重复的三位数字")

A = [1, 2, 3, 4]
c = [0, 0, 0, 0]
marked = [False, False, False, False]

index = 0


# dfs深度优先搜索
def dfs(a, marked, c, index):
    # 终止条件
    if index == 3:
        print(f"{c[0] * 100 + c[1] * 10 + c[2]}")
        return
    for i in range(4):
        if marked[i] == False:
            c[index] = a[i]
            marked[i] = True
            dfs(a, marked, c, index + 1)
            # 遍历完成将marked置为False
            marked[i] = False


dfs(A, marked, c, index)
